#define _CRT_SECURE_NO_WARNINGS 1

#include "game.h"

char mine[ROWS][COLS] = { 0 }; //存放雷的信息
char show[ROWS][COLS] = { 0 }; //存放排查出的雷的信息

void game()
{
	//初始化棋盘
	InitBoard(show, ROWS, COLS, '*');
	InitBoard(mine, ROWS, COLS, '0');

	//打印棋盘
	SetMine(mine, ROW, COL);

	//布置雷
	DisplayBoard(show, ROW, COL);
	//DisplayBoard(mine, ROW, COL);

	//排查雷
	FindMine(mine, show, ROW, COL);
}
void menu()
{
	printf("*************************\n");
	printf("*******  1. play    *****\n");
	printf("*******  0. exit    *****\n");
	printf("*************************\n");
}
void test()
{
	srand((unsigned int)time(NULL));
	int select;
	do {
		menu();
		printf("请选择：");
		scanf("%d", &select);
		switch (select)
		{
		case 1:
			game();
			break;
		case 0:
			printf("游戏已退出\n");
			break;
		default:
			printf("选择错误，请重新选择\n");
		}
	} while (select);
}
int main()
{
	test();
	return 0;
}